const  { returnInfo } = require('../libs/utils'),
        { LOGIN } = require('../config/error_config');

module.exports = async (ctx, next) => {
  //判断session和session.userInfo
  if(ctx.session.userInfo) {
    await next();
    return;
  }
  
  ctx.body = returnInfo(LOGIN.NOT_LOGIN_STATUS);
  ctx.response.redirect('/user/login');
}